package model

import (
	"context"
	"fmt"
	"service/ctrl"
	"service/model/mod"

	gpb "gitee.com/cloudapex/protos/crm_order/pb"
	"google.golang.org/grpc"
)

var Order order

type order struct {
	cli gpb.CrmOrderClient
}

func init() {
	ctrl.GCon.RegistClienter(mod.GCONN_CRM_ORDER, func(c *grpc.ClientConn) {
		Order.cli = gpb.NewCrmOrderClient(c)
	})
}

func (this *order) GetPayParam(ctx context.Context, in *gpb.PayParaReq) (*gpb.PayParaRes, error) {
	fmt.Println(this.cli)
	return this.cli.GetPayParams(ctx, in)
}

//下单接口
func (this *order) CrmOrderCreate(ctx context.Context, in *gpb.CrmOrderCreateListReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmOrderCreate(ctx, in)
}

//定金尾款下单
func (this *order) CrmDepositOrderCreate(ctx context.Context, in *gpb.CrmOrderCreateListReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmDepositOrderCreate(ctx, in)
}

//订单详情入参数
func (this *order) CrmOrderInfoCreate(ctx context.Context, in *gpb.CrmOrderInfoListReq) (*gpb.CrmOrderInfoRes, error) {
	return this.cli.CrmOrderInfoCreate(ctx, in)
}

func (this *order) CrmOrderList(ctx context.Context, in *gpb.CrmOrderListReq) (*gpb.CrmOrderListRes, error) {
	return this.cli.CrmOrderList(ctx, in)
}

func (this *order) CrmOrderAdminList(ctx context.Context, in *gpb.CrmOrderListReq) (*gpb.CrmOrderListRes, error) {
	return this.cli.CrmOrderAdminList(ctx, in)
}

func (this *order) CrmOrderStatus(ctx context.Context, in *gpb.CrmOrderStatusReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmOrderStatus(ctx, in)
}

func (this *order) CrmTemporaryOrderList(ctx context.Context, in *gpb.CrmTemporaryOrderListReq) (*gpb.CrmTemporaryOrderListRes, error) {
	return this.cli.CrmTemporaryOrderList(ctx, in)
}

func (this *order) CrmTemporaryOrderCreate(ctx context.Context, in *gpb.CrmTemporaryOrderCreateReq) (*gpb.CrmTemporaryOrderCreateRes, error) {
	return this.cli.CrmTemporaryOrderCreate(ctx, in)
}

func (this *order) CrmTemporaryOrderStatus(ctx context.Context, in *gpb.CrmTemporaryOrderStatusReq) (*gpb.CrmTemporaryOrderInfoRes, error) {
	return this.cli.CrmTemporaryOrderStatus(ctx, in)
}

func (this *order) GetOrderInfo(ctx context.Context, in *gpb.CrmOrderGetReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmOrderGet(ctx, in)
}

func (this *order) CrmOrderStatistic(ctx context.Context, in *gpb.OrderStatisticsReq) (*gpb.OrderStatisticsRes, error) {
	return this.cli.CrmOrderStatistics(ctx, in)
}

func (this *order) CrmOrderUpdate(ctx context.Context, in *gpb.CrmOrderStatusReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmOrderStatus(ctx, in)
}

func (this *order) CrmOrderLogCreate(ctx context.Context, in *gpb.CrmOrderLogReq) (*gpb.CrmOrderLogRes, error) {
	return this.cli.CrmOrderLogCreate(ctx, in)
}

func (this *order) CrmOrderLogList(ctx context.Context, in *gpb.CrmOrderLogListReq) (*gpb.CrmOrderLogListRes, error) {
	return this.cli.CrmOrderLogList(ctx, in)
}

func (this *order) CrmOrderDepsitBla(ctx context.Context, in *gpb.CrmOrderGetReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmOrderDepsitBla(ctx, in)
}

func (this *order) CrmSubOrderList(ctx context.Context, in *gpb.CrmOrderGetReq) (*gpb.CrmOrderListRes, error) {
	return this.cli.CrmSubOrderList(ctx, in)
}

/*
分隔符































*/
// 金卡开课
func (this *order) CrmGoldenOrderCreate(ctx context.Context, in *gpb.CrmGoldenOrderCreateReq) (*gpb.CrmGoldenOrderCreateRes, error) {
	return this.cli.CrmGoldenOrderCreate(ctx, in)
}

// 金卡列表
func (this *order) CrmGoldenOrderList(ctx context.Context, in *gpb.CrmGoldenOrderListReq) (*gpb.CrmGoldenOrderListRes, error) {
	return this.cli.CrmGoldenOrderList(ctx, in)
}

// 金卡状态更改
func (this *order) CrmGoldenOrderStatus(ctx context.Context, in *gpb.CrmGoldenOrderBhReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmGoldenOrderStatus(ctx, in)
}

// 金卡信息
func (this *order) CrmGoldenOrderGet(ctx context.Context, in *gpb.CrmGoldenOrderGetReq) (*gpb.CrmGoldenOrderCreateRes, error) {
	return this.cli.CrmGoldenOrderGet(ctx, in)
}

//修改正在进行的子订单 状态为已结束
func (this *order) CrmDepositOrderEnded(ctx context.Context, in *gpb.CrmOrderGetReq) (*gpb.CrmOrderCreateRes, error) {
	return this.cli.CrmDepositOrderEnded(ctx, in)
}
